from aiogram_dialog import Dialog, Window
from aiogram_dialog.widgets.kbd import Button, Cancel

from src.bot.dialogs.extras import copy_start_data_to_ctx
from src.bot.dialogs.getters.subscriptions import subscriptions_prices_getter
from src.bot.dialogs.widgets import LocaleText
from src.bot.states import BuySubscriptionSG

from .handlers import select_subscription_type

select_subscription_type_window = Window(
    LocaleText("select-subscription-type-msg"),
    LocaleText(
        "subscription-prices-msg",
        currency_symbol="{currency_symbol}",
        price_one_calendar="{price_one_calendar}",
        price_seven_calendars="{price_seven_calendars}",
        price_unlimited="{price_unlimited}",
    ),
    Button(
        LocaleText("one_calendar"),
        id="one_calendar",
        on_click=select_subscription_type,
    ),
    Button(
        LocaleText("seven_calendars"),
        id="seven_calendars",
        on_click=select_subscription_type,
    ),
    Button(
        LocaleText("unlimited"),
        id="unlimited",
        on_click=select_subscription_type,
    ),
    Cancel(LocaleText("back-btn")),
    getter=subscriptions_prices_getter,
    state=BuySubscriptionSG.select_subscription_type,
)

buy_subscription_dialog = Dialog(
    select_subscription_type_window,
    on_start=copy_start_data_to_ctx,
)
